package com.vic.mvc.framework.tools;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;

import com.vic.mvc.framework.util.ObjectUtil;

/**
 * 对配置文件进行加载
 * @author VIC
 *
 */
public class ConfigUtil {

	private static String pathName = "config";
	
	private static final Map<String, String> configMap = new HashMap<String, String>();
	
	static {
		ResourceBundle bundle =  ResourceBundle.getBundle(pathName);
		Enumeration<String> keys =  bundle.getKeys();
		if(ObjectUtil.isNotNull(keys)){
			while(keys.hasMoreElements()) {
				String key = keys.nextElement();
				configMap.put(key, bundle.getString(key));
			}
		}
		
	}
	
	public static String get(String key){
		return configMap.get(key);
	}
	
}
